﻿using System.Web;
using System.Web.Mvc;

namespace dPet.Web.Admin.Fliters
{
	using dPet.Web.Admin.ViewModels;
	using Hangerd.Mvc.Attributes;

	public class AdminLoginAuthAttribute : LoginAuthAttribute
	{
		public AdminLoginAuthAttribute()
			: base("Login", "Home")
		{ }

		protected override bool LoginAuthorizeCore(HttpContextBase httpContext)
		{
			if (base.LoginAuthorizeCore(httpContext))
			{
				if (AdministratorModel.Current != null)
				{
					return true;
				}
			}

			return false;
		}

		protected override void OnRolePrivilegeCheck(AuthorizationContext filterContext)
		{
			return;
		} 
	}
}
